// +----------------------------------------------------------------------
// | FileName:   ${file_name}
// +----------------------------------------------------------------------
// | CreateTime: ${date}  ${time}
// +----------------------------------------------------------------------
// | Author:     xab(admin@xueyong.net.cn)
// +----------------------------------------------------------------------
// | Description:
// +----------------------------------------------------------------------

package cn.xabad.commons.sample.modules;

import android.app.Application;
import android.content.Context;
import cn.xabad.commons.sample.SampleApplication;
import cn.xabad.commons.tools.PreferenceU;
import dagger.Module;
import dagger.Provides;
import javax.inject.Singleton;

@Module
public class AppModule {
    private final SampleApplication app;

    public AppModule(SampleApplication app) {
        this.app = app;
    }

    @Provides
    @Singleton
    public Application provideApplication() {
        return app;
    }

    @Provides
    @Singleton
    public Context provideContext() {
        return app.getApplicationContext();
    }

    @Provides
    @Singleton PreferenceU providePreferenceU() {
        return PreferenceU.getInstance(app.getApplicationContext());
    }

}
